<?php
class ServiceCheck extends Check {

    public function addCheck(Model &$model,$condition) {
        if(self::checkStrLength($_POST['name'],2,'min')) {
            $this->flag = false;
            $this->message[] = '售后服务名称不能少于两位!';
        }
        if(self::checkStrLength($_POST['name'],20,'max')) {
            $this->flag = false;
            $this->message[] = '售后服务名称不能大于二十位!';
        }
        if($model->isOne($condition)) {
            $this->flag = false;
            $this->message[] = '售后服务名称已经被占用!!';
        }
        return $this->flag;
    }

    public function ajaxCheckName(Model &$model,$condition) {
        echo $model->isOne($condition) ? 1 : 2;
    }

}


?>